<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>chat</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script>
        // var count=0;
        // var all;
        // var s=new Array();//数组
        //
        // //delete arr[x];
        //
        // function add(){
        //     s.push(count);
        //     var result="";
        //     for(var i=0;i<s.length;i++){
        //         if(s[i]!=undefined){
        //             result+=s[i]+",";
        //         }
        //     }
        //     $("#str").val(result);
        //      all=$("#all");//取到div的元素节点信息
        //     //<div id="container">
        //     // all.append("<div id='container"+count+"'>");
        //     // all.append("<p>视频标题<input type='text' name='VIDEO_TITLE' id='VIDEO_TITLE"+count+"'></p>");
        //     // all.append("<p>视频封面:<input type='file' name='attr' id='attr"+count+"'>");
        //     // all.append("<span id='file"+count+"'>请上传视频封面</span></p>");
        //     // all.append("<p><input type='button' value='删除' onclick='del("+count+");'></p>");
        //     // all.append("<hr size='3' color='pink'>");
        //     // all.append("</div>");
        //
        //    // append("<div></div>")
        //     var a1="<div id='container"+count+"'>";
        //     a1+="<p>视频标题<input type='text' name='VIDEO_TITLE"+count+"' id='VIDEO_TITLE"+count+"'></p>";
        //     a1+="<p>视频封面:<input type='file' name='attr' id='attr"+count+"'>";
        //     a1+="<p>视频地址:<input type='file' name='attr' id='attr1"+count+"'>";
        //     a1+="<span id='file"+count+"'>请上传视频封面</span></p>";
        //     a1+="<p><input type='button' value='删除' onclick='del("+count+");'></p>";
        //     a1+="<hr size='3' color='pink'>";
        //     a1+="</div>";
        //     all.append(a1);
        //     count++;
        // }
        //
        // //执行删除
        // function del(index){
        //     delete s[index];
        //     var result="";
        //     for(var i=0;i<s.length;i++){
        //         if(s[i]!=undefined){
        //             result+=s[i]+",";
        //         }
        //     }
        //     $("#str").val(result);
        //    var divResult=$("#container"+index+"");
        //   //count--;
        //    divResult.remove();
        // }
//javascript原生方法createElementById
        var count=0;
         var s=new Array();//数组
        function add() {
            s.push(count);
            var result="";
            for(var i=0;i<s.length;i++){
                if(s[i]!=undefined){
                    result+=s[i]+",";
                }
            }
            $("#str").val(result);
           // var all=$("#all");//取到最外层的div信息
            var all=document.getElementById("all");
            var div_result = document.createElement("div");//创造div节点信息
            //("<p>视频标题<input type='text' name='VIDEO_TITLE' id='VIDEO_TITLE"+count+"'></p>");
            div_result.setAttribute("id","container"+count+"");
            var p1=document.createElement("p");//创建p标签
            p1.append("视频标题:")
            var input1=document.createElement("input");
            input1.setAttribute("type",'text');
            input1.setAttribute("name",'VIDEO_TITLE'+count+'');
            p1.appendChild(input1);
            //-------------下面拼接视频封面
            var p2=document.createElement("p");//创建p标签
            p2.append("视频封面:");
            var input2=document.createElement("input");
            input2.setAttribute("type",'file');
            input2.setAttribute("name",'attr');//640*360
            p2.append("上传图片的大小建议640*360");
            p2.appendChild(input2);
            //-------------下面拼接视频地址
            var p3=document.createElement("p");//创建p标签
            p3.append("视频地址:");
            var input3=document.createElement("input");
            input3.setAttribute("type",'file');
            input3.setAttribute("name",'attr');
            p3.appendChild(input3);
            //创建删除的按钮
            var p4=document.createElement("p");//创建p标签
            var input4=document.createElement("input");
            input4.setAttribute("type",'button');
            input4.setAttribute("value",'删除');
            input4.setAttribute("onclick",'del('+count+');');
            p4.appendChild(input4);
            //------------------
            div_result.appendChild(p1);
            div_result.appendChild(p2);
            div_result.appendChild(p3);
            div_result.appendChild(p4);
            all.appendChild(div_result);
            count++;
        }

        //执行删除
        function del(index){
            console.log(index);
            delete s[index];
            var result="";
            for(var i=0;i<s.length;i++){
                if(s[i]!=undefined){
                    result+=s[i]+",";
                }
            }
            $("#str").val(result);
           var divResult=$("#container"+index+"");
          //count--;
           divResult.remove();
        }


    </script>
</head>
<body>
<p><input type="button" onclick="add();" value="增加一组视频信息"></p>
<form action="upload" method="post" enctype="multipart/form-data" id="form1">
    <input type="hidden" value="" id="str" name="str">
    <div id="all">

    </div>
<p><input type="submit" value="插入"></p>

    <!--
    <p>视频标题<input type="text" name="VIDEO_TITLE"></p>
    <p>视频封面:<input type="file" name="attr" id="attr">
    <span id="file1">请上传视频封面</span></p>
    <p><input type="button" value="删除"></p>
    <hr size="3" color="pink">
    -->

</form>
</body>
</html>
<!--
select * from tb_student

--去掉重复的 all不去重
select * from tb_student union  select * from tb_video

select * from tb_student where STUDENT_SCORE>(select avg(STUDENT_SCORE) from tb_student where STUDENT_CLASS='JAVA1') union
select * from tb_student where STUDENT_SCORE>(select avg(STUDENT_SCORE) from tb_student where STUDENT_CLASS='JAVA2') union
select * from tb_student where STUDENT_SCORE>(select avg(STUDENT_SCORE) from tb_student where STUDENT_CLASS='JAVA3')

select * from tb_student as t where t.STUDENT_SCORE>(select avg(STUDENT_SCORE) from tb_student as t1 where t.STUDENT_CLASS=t1.STUDENT_CLASS group by STUDENT_CLASS)



-->